#include <vector>
#include <functional>
#include <iostream>
#include <numeric>
#include <chrono>
#include <execution>

int main()
{
    std::vector<double> xvalues(1000000007, 1.0), yvalues(1000000007, 1.0);

    {
        auto t1 = std::chrono::high_resolution_clock::now();
        double result = std::transform_reduce(
            std::execution::par_unseq,
            xvalues.begin(), xvalues.end(),
            yvalues.begin(), 0.0);
        auto t2 = std::chrono::high_resolution_clock::now();
        std::chrono::duration<double, std::milli> ms = t2 - t1;
        std::cout << std::fixed << "std::transform_reduce,par result " << result
                  << " took " << ms.count() << " ms\n";
    }
    {
        auto t1 = std::chrono::high_resolution_clock::now();
        double result = std::transform_reduce(
            std::execution::seq,
            xvalues.begin(), xvalues.end(),
            yvalues.begin(), 0.0);
        auto t2 = std::chrono::high_resolution_clock::now();
        std::chrono::duration<double, std::milli> ms = t2 - t1;
        std::cout << std::fixed << "std::transform_reduce,seq result " << result
                  << " took " << ms.count() << " ms\n";
    }
}

// std::transform_reduce,par result 1000000007.000000 took 1038.397247 ms
// std::transform_reduce,seq result 1000000007.000000 took 1088.210441 ms